//
//  DrawView.m
//  绘制文字和图片
//
//  Created by student on 16/4/6.
//  Copyright © 2016年 NIIT. All rights reserved.
//

#import "DrawView.h"

@implementation DrawView


// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)setSelImage:(UIImage *)selImage
{
    _selImage = selImage;
    
    [self setNeedsDisplay];
}

- (void)drawRect:(CGRect)rect
{
    // 1 绘制图片
    
    // 程序中已有的图片
    //UIImage *img = [UIImage imageNamed:@"langmuwine"];
    //[img drawAtPoint:CGPointZero];// 图片的起始点
    //[img drawInRect:CGRectMake(50, 50, 29, 45)];
    //[img drawInRect:rect];// 在范围内画图片
    
    
    
    // 查看外部传入的图片
    [self.selImage drawInRect:rect];
    // Drawing code
    
    // 2 绘制文字
    
//    NSString *str = @"哈哈哈哈哈";
//    NSMutableDictionary *textDict = [NSMutableDictionary dictionary];
//    textDict[NSForegroundColorAttributeName] = [UIColor redColor];// 设置文字的颜色
//    textDict[NSFontAttributeName] = [UIFont systemFontOfSize:20];// 设置字体的大小
//    
//    NSAttributedString *aStr = [[NSAttributedString alloc] initWithString:str attributes:textDict];// 初始化str
//    
//    [aStr drawAtPoint:CGPointZero];
}


@end
